<?php
   
   class Block extends Admin{
   	
	  public function __construct(){
			parent::__construct();
	  }
	  
	  public function setPlugIn(){
	  	return array("cache.php");
	  }
	  
	 /*
	  * 模版组列表
	  */ 
	  public function GroupList(){ 
	  	$this->mod = "GroupList";
	  	$type = trim($_GET['type']);
		$this->_T['type'] = $type;
		$this->_T['groups'] = DB::fetch_array("select *from `bb_template_group` where `type`='{$type}'"); 
		$this->template("parent");
	  }
	  
	 /*
	  * 添加模版组（界面）
	  */ 
	  public function AddGroup(){  
	  	$this->mod = "AddGroup";
		$this->_T['type'] = $_GET['type'];
		$this->template("parent");
	  }
	  
	 /*
	  * 添加模版组（处理）
	  */
	  public function CreateGroup(){ 
	  	$template_group = array();
		$template_group['name'] = $_POST['name'];
		$template_group['type'] = $_POST['type'];
		$template_group['des']  = $_POST['des'];
		$url = "?m=Admin/Block/GroupList&type=".$template_group['type'];
		if(DB::insert("bb_template_group", $template_group)){
			$this->showmessage("模版组添加成功",$url ,2000, "返回模版组列表");
		}
		$this->showmessage("模版组添加失败","goback" ,2000, "返回");
	  }
	  
	 /*
	  * 编辑模版组（界面）
	  */
	  public function EditGroup(){
	  	$this->mod = "EditGroup";
	  	$groupid = $_GET['groupid'];
		$template_group= DB::fetch_row("select *from `bb_template_group` where `groupid`='{$groupid}'");
		$this->_T['type'] = $template_group['type'];
		$this->_T['template_group'] = $template_group;
		$this->template("parent");
	  }
	  
	 /*
	  * 编辑模版组（处理）
	  */
	  public function UpdateGroup(){
	  	$condition = array();
		$condition['groupid'] = $_POST['groupid'];
		$template_group = array();
		$template_group['name'] = $_POST['name']; 
		$template_group['des']  = $_POST['des'];
		$url = "?m=Admin/Block/GroupList&type=".$_POST['type'];
		if(DB::update("bb_template_group", $template_group, $condition)){
			$this->showmessage("模版组更新成功",$url ,2000, "返回模版组列表");
		}
		$this->showmessage("模版组更新失败","goback" ,2000, "返回");
	  }
	 
	 /*
	  * 添加模版（界面）
	  */
	  public function AddTemplate(){  
	  	$this->mod = "AddTemplate";
		$groupid = $_GET['groupid'];
		$blocks = DB::fetch_array("select *from `bb_block` where `groupid`='{$groupid}'");
		$terminals = DB::fetch_array("select *from `bb_terminal` where 1");
		$terminalForUses = array();
		$existOne = false;   //至少存在一个未被添加模板的终端的标志，此处所有终端均已被添加模板
		foreach($terminals as $terminalKey => $terminalVal){
			$exist = false;   //终端存在标志
			foreach($blocks as $blockVal){
				if($blockVal['terminalid']==$terminalVal['terminalid']){
					$exist = true;
					break;
				}
			}
            if(!$exist){
            	$terminalForUses[] = $terminalVal;
				$existOne = true;
            }
		}
		if(!$existOne){
			$this->showmessage("所有终端均已经添加模版","goback" ,2000, "返回");
		}
		$this->_T['terminals'] = $terminalForUses;
		$group = DB::fetch_row("select *from `bb_template_group` where `groupid`='{$groupid}'");
		$this->_T['group'] = $group;
		$this->_T['type'] = $group['type'];  //模版组类型
		$this->template("parent");
	  }
	  
	  /*
	   * 添加模版（处理）
	   */
	  public function CreateTemplate(){	 
	    $type = $_POST['type'];
	  	$block_template['content']=$_POST['HTMLcon'];
		$block_template['css'] = $_POST['CSScon'];
		$block_template['js']  = $_POST['JScon'];
		switch($type){
			case 'IndexGroup':$block_template['class'] = 1;break;
			case 'HeaderGroup':$block_template['class'] = 2;break;
			case 'FooterGroup':$block_template['class'] = 3;break;
			case 'FooterGroup':$block_template['class'] = 3;break;
		}
		$templateid = DB::insert("bb_block_template", $block_template);
		if(!$templateid){
			$this->showmessage("模版创建失败，错误代号1","goback" ,2000, "返回");
		}
		$block_template_info['templateid'] = $templateid;
	  	$block_template_info['name'] = $_POST['alias'];
		if(!DB::insert("bb_block_template_info", $block_template_info)){
			$this->showmessage("模版创建失败，错误代号2","goback" ,2000, "返回");
		}
		$block['name'] = $_POST['name'];
	  	$block['terminalid']  = $_POST['terminal'];
		$block['class']     = 1;
		$block['groupid']   = $_POST['groupid'];
		$block['templateid']= $templateid;
		$blockid = DB::insert("bb_block", $block);
		if(!$blockid){
			$this->showmessage("模版创建失败,错误代号3","goback" ,2000, "返回");
		}
		$block_info['blockid'] = $blockid;
		$block_info['alias'] = $_POST['alias'];
		if(!DB::insert("bb_block_info", $block_info)){
			$this->showmessage("模版创建失败,错误代号4","goback" ,2000, "返回");
		}
		if(!Cache::updateIndex()){
			Cache::clearCompiled();
			$this->showmessage("缓存更新失败","?m=Admin/Block/GroupList&type={$type}" ,2000, "返回");
		}
		$this->showmessage("模版创建成功","?m=Admin/Block/GroupList&type={$type}" ,2000, "返回");
	  }

       /*
	    * 编辑模版（界面）
	    */
	   public function EditTemplate(){  
	   	$this->mod = "EditTemplate";
	   	$groupid = $_GET['groupid']; 
		$this->_T['groupid'] = $groupid;
		$terminalid = $_GET['terminalid'];
		$conditionStr = $terminalid?"where B.`terminalid`='{$terminalid}' and B.`groupid`='{$groupid}'":"where B.`groupid`='{$groupid}'";
		$block = DB::fetch_row("select *from `bb_block` as B left join `bb_block_info` as BI on B.`blockid`=BI.`blockid`
								left join `bb_block_template` as BT on B.`templateid`=BT.`templateid` left join `bb_block_template_info`
								as BTI on BT.`templateid`=BTI.`templateid`".$conditionStr);
		$block['name'] = $block[1]; //未知bug
		if(!$block['blockid']){
			$this->showmessage("尚未添加模版","goback" ,2000, "返回");
		}
		$this->_T['block'] = $block;
		$terminals = DB::fetch_array("select *from `bb_block` as B left join `bb_terminal` as T on B.`terminalid`=T.`terminalid` 
		                          where B.`groupid` = '{$groupid}'");
		$this->_T['terminals'] = $terminals;
		$group = DB::fetch_row("select *from `bb_template_group` where `groupid`='{$groupid}'");
		$this->_T['group'] = $group;
		$this->_T['type'] = $group['type'];  //模版组类型
		$this->template("parent");
	   }
       
	   /*
	    * 更新模版（处理）
	    */
	   public function UpdateTemplate(){
	   	$blockContition = array();
		$blockContition['blockid'] = $_POST['blockid'];
		$block = array();
		$block['name'] = $_POST['name'];
		if(!DB::update("bb_block", $block, $blockContition)){
			$this->showmessage("编辑失败，错误代号1","goback" ,2000, "返回");
		}
        $block_info = array();
		$block_info['alias'] = $_POST['alias'];
		if(!DB::update("bb_block_info", $block_info, $blockContition)){
			$this->showmessage("编辑失败，错误代号2","goback" ,2000, "返回");
		}
		$templateCondition = array();
		$templateCondition['templateid'] = $_POST['templateid'];
		$block_template = array();
		$block_template['content'] = $_POST['HTMLcon'];
		$block_template['css'] = $_POST['CSScon'];
		$block_template['js'] = $_POST['JScon'];
		if(!DB::update("bb_block_template", $block_template, $templateCondition)){
			$this->showmessage("编辑失败，错误代号3","goback" ,2000, "返回");
		}
		$block_template_info = array();
		$block_template_info['name'] = $_POST['alias'];
		if(!DB::update("bb_block_template_info", $block_template_info, $templateCondition)){
			$this->showmessage("编辑失败，错误代号4","goback" ,2000, "返回");
		}
		$groupid = $_POST['groupid'];
		$terminalid = $_POST['terminal'];
		$groupType = $_POST['type'];
		if($groupType=="IndexGroup"||$groupType=="HeaderGroup"||$groupType=="FooterGroup"){ //更新首页缓存
			if(!Cache::updateIndex()){
				Cache::clearCompiled();
				$this->showmessage("缓存更新失败","?m=Admin/Block/EditTemplate&groupid={$groupid}&terminalid={$terminalid}" ,2000, "返回");
			}
		}
		if($groupType!="IndexGroup"){ //更新栏目缓存
			if(!Cache::updateCategoryCache($groupType, $groupid)){
				Cache::clearCompiled();
				$this->showmessage("缓存更新失败","?m=Admin/Block/EditTemplate&groupid={$groupid}&terminalid={$terminalid}" ,2000, "返回");
			}
		}
		$this->showmessage("模版编辑成功","?m=Admin/Block/EditTemplate&groupid={$groupid}&terminalid={$terminalid}" ,2000, "返回");
	   }
       
	   /*
	    * 设置默认模版
	    */
       public function SetDefault(){
       	$type    = $_GET['type']; 
       	$groupid = $_GET['groupid'];
		DB::Query("update `bb_template_group` set `isused`='0' where `type`='{$type}' and `groupid`!='{$groupid}'");
		DB::Query("update `bb_template_group` set `isused`='1' where `type`='{$type}' and `groupid` ='{$groupid}'");
		if(Cache::updateDefaultCash($groupid, $type))
			$this->showmessage("模版组已经启用","?m=Admin/Block/GroupList&type={$type}" ,2000, "返回首页模版组列表");
		$this->showmessage("模版组启用失败","goback" ,2000, "返回");
       }
       
	   /*
	    * 删除模版组
	    */ 
	   public function DeleteGroup(){
	   	$type    = $_GET['type']; 
		$groupid   = intval($_GET['groupid']);
	   	$condition = array();
	   	$condition['groupid'] = $groupid;
	   	if(!DB::delete("bb_template_group", $condition)){
	   		$this->showmessage("模版组删除失败，错误代号1","goback" ,2000, "返回首页模版组列表");
	   	}
		$blockid = DB::delete("bb_block", $condition);
		if(!$blockid){
			$this->showmessage("模版组删除失败，错误代号2","goback" ,2000, "返回首页模版组列表");
		}
		$condition = array();
		$condition['blockid'] = $blockid;
		if(!DB::delete("bb_block_info", $condition)){
			$this->showmessage("模版组删除失败，错误代号3","goback" ,2000, "返回首页模版组列表");
		}
		$this->showmessage("模版组已删除","?m=Admin/Block/GroupList&type={$type}" ,2000, "返回首页模版组列表");
	   }
	   
	   /*
	    *block列表 
	    */
	   public function BlockList(){
	   	$this->mod = "BlockList";
		$blocks = DB::fetch_array("select *from `bb_block` as B left join `bb_block_info` as BI on B.`blockid`=BI.`blockid` where B.`class` = '0'");
		$this->_T['blocks'] = $blocks;
		$this->template("parent");
	   }
	   
	   /*
	    * 添加block（界面）
	    */
	   public function AddBlock(){
	   	$this->mod = "AddBlock";
		$block_tempaltes = DB::fetch_array("select *from `bb_block_template` as BT left join `bb_block_template_info` as BTI 
		                                   on BT.`templateid`=BTI.`templateid` ");
		$this->_T['templates'] = $block_tempaltes;
		$this->template("parent");
	   }
	   
	   /*
	    * 添加block（处理）
	    */
	   public function CreateBlock(){
	   	$block = array();
	   	$block['name'] = $_POST['name'];
		$block['templateid'] = $_POST['template'];
		$block['width']= $_POST['width'];
		$block['height'] = $_POST['height'];
		$blockid = DB::insert("bb_block", $block);
		if(!$this->_updateBlockCash($blockid,$block['templateid'])){
			$this->showmessage("block创建失败，错误代号1","goback" ,2000, "返回");
		}
		if(!$blockid){
			$this->showmessage("block创建失败，错误代号2","goback" ,2000, "返回");
		}
		$block_info = array();
		$block_info['blockid'] = $blockid;
		$block_info['alias'] = $_POST['alias'];
		$block_info['description'] = $_POST['description'];
		if(!DB::insert("bb_block_info", $block_info)){
			$this->showmessage("block创建失败，错误代号3","goback" ,2000, "返回");
		}
		$this->showmessage("block创建成功","?m=Admin/Block/BlockList" ,2000, "返回");
	   }
	   
	   /*
	    * 编辑block（界面）
	    */
	   public function EditBlock(){
	   	$this->mod = "EditBlock";
	   	$blockid = intval($_GET['blockid']);
		$block = DB::fetch_row("select *from `bb_block` as B left join `bb_block_info` as BI on 
		                       B.`blockid` = BI.`blockid` where B.`blockid`='{$blockid}'");
		$block_tempaltes = DB::fetch_array("select *from `bb_block_template` as BT left join `bb_block_template_info` as BTI 
		                                   on BT.`templateid`=BTI.`templateid` ");
		$this->_T['block'] = $block;
		$this->_T['templates'] = $block_tempaltes;
		$this->template("parent");
	   }  
	   
	   /*
	    * 更新block（处理）
	    */
	   public function UpdateBlock(){
	   	$condition = array();
		$condition['blockid'] = $_POST['blockid'];
	   	$block = array();
		$block['name'] = $_POST['name'];
		$block['templateid'] = $_POST['template'];
		$block['width']= $_POST['width'];
		$block['height'] = $_POST['height'];
		if(!$this->_updateBlockCash($condition['blockid'],$block['templateid'])){
			$this->showmessage("block更新失败，错误代号1","goback" ,2000, "返回");
		}
		if(!DB::update("bb_block", $block, $condition)){
			$this->showmessage("block更新失败，错误代号2","goback" ,2000, "返回");
		}
		$block_info = array();
		$block_info['alias'] = $_POST['alias'];
		$block_info['description'] = $_POST['description'];
		if(!DB::update("bb_block_info", $block_info, $condition)){
			$this->showmessage("block更新失败，错误代号3","goback" ,2000, "返回");
		}
		$this->showmessage("block更新成功","?m=Admin/Block/BlockList" ,2000, "返回");
	   } 
	   
	   /*
	    * 删除block
	    */ 
	    public function DeleteBlock(){
	    	$condition = array();
	    	$condition['blockid'] = intval($_GET['blockid']);
			if(!DB::delete("bb_block", $condition)){
				$this->showmessage("block删除失败，错误代号1","goback" ,2000, "返回");
			}
			if(!DB::delete("bb_block_info", $condition)){
				$this->showmessage("block删除失败，错误代号2","goback" ,2000, "返回");
			}
			$this->_updateBlocksCash();
			$this->showmessage("block删除成功","?m=Admin/Block/BlockList" ,2000, "返回");
	    }
	   
	   /*
	    * block模版列表
	    */
	   public function BlockTemplateList(){
	   	$this->mod = "BlockTemplateList";
		$blockTemplates = DB::fetch_array("select *from `bb_block_template` as BT left join `bb_block_template_info` as BTI 
		                                  on BT.`templateid`=BTI.`templateid` where BT.`class`='0'");
		$this->_T['blockTemplates'] = $blockTemplates;
		$this->template("parent");
	   }
	   
	   /*
	    * 添加block模版（界面）
	    */
	   public function AddBlockTemplate(){
	   	$this->mod = "AddBlockTemplate";
		$querys = DB::fetch_array("select *from `bb_block_query` where 1");
		$this->_T['querys'] = $querys;
		$this->template("parent");
	   }
	   
	   /*
	    * 添加block模版（处理）
	    */
	   public function CreateBlockTemplate(){
	   	$block_template = array();
		$block_template['content'] = $_POST['HTMLcon'];
		$block_template['css'] = $_POST['CSScon'];
		$block_template['js'] = $_POST['JScon'];
		$block_template['queryid'] = implode('|',$_POST['querys']);
		for($i=0;$i<count($_POST['vars']);$i++){
			if(!$_POST['vars'][$i]){
				unset($_POST['vars'][$i]);
				unset($_POST['nums'][$i]);
				unset($_POST['categorys'][$i]);
			}
		}
		$block_template['var']      = implode('|',$_POST['vars']);
		$block_template['num']      = implode('|',$_POST['nums']);
		$block_template['category'] = implode('|',$_POST['categorys']);
		$templateid = DB::insert("bb_block_template", $block_template);
		if(!$templateid){
			$this->showmessage("模版添加失败，错误代号2","goback" ,2000, "返回");
		}
		$block_template_info = array();
		$block_template_info['templateid']=$templateid;
		$block_template_info['name'] = $_POST['name'];
		$block_template_info['description'] = $_POST['description'];
		if(!DB::insert("bb_block_template_info", $block_template_info)){
			$this->showmessage("模版添加失败，错误代号3","goback" ,2000, "返回");
		}
		$this->showmessage("模版添加成功","?m=Admin/Block/BlockTemplateList" ,2000, "返回");
	   }
	   
	   /*
	    * 编辑block模版（界面）
	    */
	   public function EditBlockTemplate(){
	   	$this->mod = "EditBlockTemplate";
	   	$templateid = $_GET['templateid'];
		$block_template = DB::fetch_row("select *from `bb_block_template` as BT left join `bb_block_template_info` as BTI 
		                               on BT.`templateid` = BTI.`templateid` where BT.`templateid` = '{$templateid}'");
		$this->_T['block_template']         = $block_template;
		$querys = DB::fetch_array("select *from `bb_block_query` where 1");
		$block_template_queryids  = explode("|",$block_template['queryid']);
		$block_template_vars      = explode("|",$block_template['var']);
		$block_template_nums       = explode("|",$block_template['num']);
		$block_template_categorys  = explode("|",$block_template['category']);
		for($i=0;$i<count($querys);$i++){
			for($j=0;$j<count($block_template_queryids);$j++){
				if($querys[$i]['queryid']==$block_template_queryids[$j]){
					$querys[$i]['checked'] = "checked";
					$querys[$i]['var'] = $block_template_vars[$j];
					$querys[$i]['num'] = $block_template_nums[$j];
					$querys[$i]['category'] = $block_template_categorys[$j];
					break; 
				}
			}
		}
		$this->_T['querys'] = $querys;
		$this->template("parent");
	   }
	   
	   /*
	    * 编辑block模版（处理）
	    */
	   public function UpdateBlockTemplate(){
	   	$condition = array();
		$condition['templateid'] = $_POST['templateid'];
	   	$block_template = array();
		$block_template['content'] = $_POST['HTMLcon'];
		$block_template['css'] = $_POST['CSScon'];
		$block_template['js']  = $_POST['JScon'];
		$block_template['queryid'] = implode('|',$_POST['querys']);
		$block_template['queryid'] = implode('|',$_POST['querys']);
		for($i=0;$i<count($_POST['vars']);$i++){
			if(!$_POST['vars'][$i]){
				unset($_POST['vars'][$i]);
				unset($_POST['nums'][$i]);
				unset($_POST['categorys'][$i]);
			}
		}
		$block_template['var']      = implode('|',$_POST['vars']);
		$block_template['num']      = implode('|',$_POST['nums']);
		$block_template['category'] = implode('|',$_POST['categorys']);
		if(!DB::update("bb_block_template", $block_template, $condition)){
			$this->showmessage("模版更新失败，错误代号1","goback" ,2000, "返回");
		}
		$block_template_info = array();
		$block_template_info['name'] = $_POST['name'];
		$block_template_info['description'] = $_POST['description'];
		if(!DB::update("bb_block_template_info", $block_template_info, $condition)){
			$this->showmessage("模版更新失败，错误代号2","goback" ,2000, "返回");
		}
		$this->_updateBlocksCash(); //更新block缓存
		$this->showmessage("模版更新成功","?m=Admin/Block/BlockTemplateList" ,2000, "返回");
	   }

       /*
	    * 更新block缓存文件函数（私有函数）
	    */
	   private function _updateBlockCash($blockid,$templateid){
	   	$block_template = DB::fetch_row("select *from `bb_block_template` where `templateid`='{$templateid}'");
	   	$content = $block_template['content'];
		$css     = $block_template['css'];
		$js      = $block_template['js'];
	   	$cssCon  =$css?"<style type=\"text/css\">\n{$css}\n</style>\n":"";
		$jsCon   =$js?"<script language=\"Javascript\" type=\"text/javascript\">\n{$js}\n</javascript>\n":"";
		$htmlCon =$val['content'];
		$con = $content.$cssCon.$jsCon;
		$fileName = "BlockTemplate/index{$blockid}.html";
		File::deleteFile("./BlockCompiled", "delete files"); //清空编译文件
		$succeed = true;
		if(!File::createText($fileName,$con)){
			$succeed = false;
		}
		return $succeed;
	   }
       
	   /*
	    *更新所有block缓存(私有函数)
	    */
	   public function _updateBlocksCash(){
	   	$block_templates = DB::fetch_array("select *from `bb_block` as B left join `bb_block_template` as BT on 
	   	                                   B.`templateid` = BT.`templateid` where B.`class` = '0'");
		foreach($block_templates as $val){
			$blockid = $val['blockid'];
			$content = $val['content'];
		    $css     = $val['css'];
		    $js      = $val['js'];
	   	    $cssCon  =$css?"<style type=\"text/css\">\n{$css}\n</style>\n":"";
		    $jsCon   =$js?"<script language=\"Javascript\" type=\"text/javascript\">\n{$js}\n</javascript>\n":"";
		    $htmlCon =$val['content'];
		    $con = $content.$cssCon.$jsCon;
		    $fileName = "BlockTemplate/index{$blockid}.html";
		    File::createText($fileName,$con);
		 }
		File::deleteFile("./BlockCompiled", "delete files"); //清空编译文件
	   }
	   
	   /*
	    * 删除block模版
	    */
	   public function DeleteBlockTemplate(){
	   	$condition  = array();
	   	$condition['templateid'] = intval($_GET['templateid']);
		echo $condition['templateid'];
		if(!DB::delete("bb_block_template", $condition)){
			$this->showmessage("模版删除失败，错误代号1","goback" ,2000, "返回");
		}
		if(!DB::delete("bb_block_template_info", $condition)){
			$this->showmessage("模版删除失败，错误代号2","goback" ,2000, "返回");
		}
		$this->showmessage("模版删除成功","?m=Admin/Block/BlockTemplateList" ,2000, "返回");
	   }
	   
	   /*
	    * block查询列表
	    */
	   public function QueryList(){
	   	$this->mod = "QueryList";
	   	$this->_T['querys']=DB::fetch_array("select *from `bb_block_query`");
		$this->template("parent");
	   }
	   
	   /*
	    * 添加block查询（界面）
	    */
	   public function AddQuery(){
	   	$this->mod = "AddQuery";
		$this->template("parent");
	   }
	   
	   /*
	    * 添加block查询（处理）
	    */
	   public function CreateQuery(){
	   	$block_query = array();
		$block_query['name']   = $_POST['name'];
		$block_query['content']= $_POST['content'];
		$block_query['description'] = $_POST['description'];
		if(!DB::insert("bb_block_query", $block_query)){
			$this->showmessage("block查询添加失败","goback" ,2000, "返回");
		}
		$this->showmessage("block查询添加成功","?m=Admin/Block/QueryList" ,2000, "返回block查询列表");
	   }
	   
	   /*
	    * 更新block查询（界面）
	    */
	   public function EditQuery(){
	   	$this->mod = "EditQuery";
	   	$queryid = intval($_GET['queryid']);
		$block_query = DB::fetch_row("select *from `bb_block_query` where `queryid`='{$queryid}'");
		$this->_T['query'] = $block_query;
		$this->template("parent");
	   }
	   
	   /*
	    * 更新block查询（处理）
	    */
	   public function UpdateQuery(){
	   	$condition = array();
		$condition['queryid'] = $_POST['queryid'];
		$block_query = array();
		$block_query['name'] = $_POST['name'];
		$block_query['content'] = $_POST['content'];
		$block_query['description'] = $_POST['description'];
		if(!DB::update("bb_block_query", $block_query, $condition)){
			$this->showmessage("block查询更新失败","goback" ,2000, "返回");
		}
		$this->showmessage("block查询更新成功","?m=Admin/Block/QueryList" ,2000, "返回block查询列表");
	   }
	   
	   /*
	    * 删除block查询（处理）
	    */
	   public function DeleteQuery(){
	   	$queryid = $_GET['queryid'];
		$condition = array();
		$condition['queryid'] = $queryid;
		if(!DB::delete("bb_block_query", $condition)){
			$this->showmessage("block查询删除失败","goback" ,2000, "返回");
		}
		$this->showmessage("block查询删除成功","?m=Admin/Block/QueryList" ,2000, "返回block查询列表");
	   }
   }









?>